home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13934 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: news.NetVision.net.il!news
  2. From: zivshosh@netvision.net.il ( Ziv)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Help, I think with an array
  5. Date: Wed, 10 Apr 1996 16:38:05 GMT
  6. Organization: NetVision LTD.
  7. Message-ID: <316be255.2788761@news.netvision.net.il>
  8. References: <4kbhcl$p4l@uwm.edu>
  9. NNTP-Posting-Host: ts005p16.pop4a.netvision.net.il
  10. X-Newsreader: Forte Agent .99c/16.141
  11.  
  12. On 8 Apr 1996 17:11:49 GMT, mardavuy@alpha2.csd.uwm.edu (Mario David
  13. Uy) wrote:
  14.  
  15. >I am a beginner to programming and I have a problem.
  16. >Well, I have this one table that I want to use.  I looks somewhat like this.
  17. >
  18. >Age           points
  19. >30             -3
  20. >31             -2
  21. >32-33          -1
  22.  
  23. You'll have to write explicitely:  32   -1
  24.                                                             33   -1
  25. >34              0
  26. >35-36           1
  27.  
  28.                                                             35     1
  29.                                                             36     1
  30. >...            ...
  31. >
  32. >What I want the program to do is have a user input the age value and then the
  33. >program will give the point value.  
  34. >
  35. >I have no idea how to do this, but I think I need to use an array
  36. >(I sure I could use if...else but I want to try to use an array.
  37. >Also I have seven of these tables)
  38. >
  39. >Thanks,
  40. >David 
  41. >mardavuy@csd.uwm.udu
  42. >-- 
  43. >-------------------------------------------------------------------------------
  44. >||                                          ||Is it gonna be hide or seek,   ||
  45. >||  Mario David Uy                          ||  is it gonna be win or lose?  ||
  46. >||      mardavuy@csd.uwm.edu                ||Is it gonna be pride that keeps||
  47.  
  48. You also need 2 arrays: one for the age, the other for the points.
  49. The input age has to be searched against the first array to get the
  50. index which will then be used to return the points. I can write the
  51. code but then you won't learn much, will you.
  52.  
  53. If thats all you need you may be much more comfortable with AWK or
  54. PERL
  55. Ziv
  56.